package com.ad.pet.app.account.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ad.pet.R;
import com.ad.pet.models.remote.account.order.TrackInfo;

import java.util.List;

/**
 * Created by SEELE on 2019/2/19.
 */

public class LogistInfoAdapter extends BaseQuickAdapter<TrackInfo,BaseViewHolder> {
    public LogistInfoAdapter(List<TrackInfo> data) {
        super(R.layout.item_packet_detail_list, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, TrackInfo item) {

        View vTopLine = helper.getView(R.id.view_top_line);
        View vBottomLine = helper.getView(R.id.view_bottom_line);
        ImageView vPoint = helper.getView(R.id.view_point);
        TextView tvDate = helper.getView(R.id.tv_date);
        TextView tvDetail = helper.getView(R.id.tv_detail);

        if (helper.getLayoutPosition()==0){
            vPoint.setImageResource(R.drawable.ic_orderdetail_yuan);
            vTopLine.setVisibility(View.INVISIBLE);
        }else if (helper.getLayoutPosition()==mData.size()-1){
            vBottomLine.setVisibility(View.INVISIBLE);
            vPoint.setImageResource(R.drawable.ic_order_sanjiao);
        }else {
            vBottomLine.setVisibility(View.VISIBLE);
            vTopLine.setVisibility(View.VISIBLE);
            vPoint.setImageResource(R.drawable.ic_order_sanjiao);
        }
        tvDate.setText(item.getDate()+" "+item.getTime()+" "+item.getWeek());
        tvDetail.setText(item.getInfo());
    }
}
